<?
	include("../seguridad.php");
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Cargar Evento</title>
<link rel="shortcut icon" href="../../IMAGENES/ico_EstasEnPosse.png" />
<link href="../../EstasEnPosse3.0/Style.css" rel="stylesheet" type="text/css" />
<!-- TinyMCE -->
<script type="text/javascript" src="../../scripts/tiny_mce/tiny_mce.js"></script>
<script type="text/javascript">
	tinyMCE.init({
		// General options
		mode : "textareas",
		theme : "simple",
		skin : "o2k7",
		skin_variant : "silver",

		plugins : "autolink,lists,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,inlinepopups,autosave",

		// Theme options
		theme_advanced_buttons1 : "save,newdocument,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,styleselect,formatselect,fontsizeselect",
		theme_advanced_buttons2 : "cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code,|,insertdate,inserttime,preview,|,forecolor,backcolor",
		theme_advanced_buttons3 : "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,emotions,iespell,media,advhr,|,print,|,ltr,rtl,|,fullscreen",
		theme_advanced_buttons4 : "insertlayer,moveforward,movebackward,absolute,|,styleprops,|,cite,abbr,acronym,del,ins,attribs,|,visualchars,nonbreaking,template,pagebreak,restoredraft",
		theme_advanced_toolbar_location : "top",
		theme_advanced_toolbar_align : "left",
		theme_advanced_statusbar_location : "bottom",
		theme_advanced_resizing : true,

		// Example word content CSS (should be your site CSS) this one removes paragraph margins
		content_css : "css/word.css",

		// Drop lists for link/image/media/template dialogs
		template_external_list_url : "lists/template_list.js",
		external_link_list_url : "lists/link_list.js",
		external_image_list_url : "lists/image_list.js",
		media_external_list_url : "lists/media_list.js",

		// Replace values for the template plugin
		template_replace_values : {
			username : "Some User",
			staffid : "991234"
		}
	});
</script>
<!-- /TinyMCE -->


	<script src="http://www.estasenposse.com/scripts/DatePicker/jquery-1.8.2.js"></script>
	<script src="http://www.estasenposse.com/scripts/DatePicker/jquery.ui.core.js"></script>
	<script src="http://www.estasenposse.com/scripts/DatePicker/jquery.ui.widget.js"></script>
	<script src="http://www.estasenposse.com/scripts/DatePicker/jquery.ui.datepicker.js"></script>
	
	
    <link rel="stylesheet" href="../../themes/base/jquery.ui.all.css">
    
     <link rel="stylesheet" href="http://www.estasenposse.com/scripts/custom-theme/jquery-ui-1.9.0.custom.css">
     <link rel="stylesheet" href="http://www.estasenposse.com/scripts/custom-theme/jquery-ui-1.9.0.custom.min.css">


	<script>
	$(function() {
		$( "#from" ).datepicker({
			defaultDate: "+1w",
			changeMonth: true,
			numberOfMonths: 3,
			onSelect: function( selectedDate ) {
				$( "#to" ).datepicker( "option", "minDate", selectedDate );
			}
		});
		$( "#to" ).datepicker({
			defaultDate: "+1w",
			changeMonth: true,
			numberOfMonths: 3,
			onSelect: function( selectedDate ) {
				$( "#from" ).datepicker( "option", "maxDate", selectedDate );
			}
		});
	});
	</script>

<style type="text/css">
a:hover {
	text-decoration: none;
	color: #F68E02;
}

a:link {
	text-decoration: none;
}
a:visited {
	text-decoration: none;
}
a:active {
	text-decoration: none;
}
</style>
<link href="../../Style.css" rel="stylesheet" type="text/css" />
<link href="../../Style.css" rel="stylesheet" type="text/css" />
</head>

<body>

<table width="800" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td colspan="3"><iframe src="../../encabezadoInternoSeccion.php" name="nombre"  width="1000" height="225" scrolling="No" frameborder="0" id="nombre"></iframe></td>
  </tr>
  <tr>
    <td width="670" height="40" bgcolor="#FF9900" class="barMenuBlanco">Cargar excepción farmacias de turno...</td>
    <td width="165" align="center" bgcolor="#CCCCCC" class="textoTituloMasNovedades" ><a href="../Menu.php" class="LinksActivos2">Menú Principal</a></td>
    <td width="165" align="center" bgcolor="#CCCCCC" class="textoTituloMasNovedades" ><a href="logout.php" class="LinksActivos2">Cerrar Cesión</a></td>
  </tr>
  <tr>
    <td height="80" colspan="3"><? 
	$novedad = isset($_POST['novedad']) ? $_POST['novedad']: NULL;
	$Titulo = isset($_POST['Titulo']) ? $_POST['Titulo']: NULL;
	$from = isset($_POST['from']) ? $_POST['from']: NULL;
	$to = isset($_POST['from']) ? $_POST['to']: NULL;
	$hh1 = isset($_POST['hh1']) ? $_POST['hh1']: NULL;
	$hh2 = isset($_POST['hh2']) ? $_POST['hh2']: NULL;
	$min1 = isset($_POST['min1']) ? $_POST['min1']: NULL;
	$min2 = isset($_POST['min2']) ? $_POST['min2']: NULL;
	$Categoria = isset($_POST['Categoria']) ? $_POST['Categoria']: NULL;
	$Localidad = isset($_POST['Localidad']) ? $_POST['Localidad']: NULL;
	$Direccion = isset($_POST['Direccion']) ? $_POST['Direccion']: NULL;
	$FuenteLink = isset($_POST['FuenteLink']) ? $_POST['FuenteLink']: NULL;
	$NombreFuente = isset($_POST['NombreFuente']) ? $_POST['NombreFuente']: NULL;
	$PalabrasClaves = isset($_POST['PalabrasClaves']) ? $_POST['PalabrasClaves']: NULL;
	
	$elm1 = isset($_POST['elm1']) ? $_POST['elm1']: NULL;
	if($novedad){	
		//VERIFICO QUE TODOS LOS CAMPOS ESTEN COMPLETOS!
		//if(($Titulo<>"") && ($Subtitulo<>"") && ($elm1<>"")){
		//if(true){
		include("../../conexionStaging.php");				
		$IP = $_SERVER['REMOTE_ADDR'];
		
		$mm1 = substr($from,0,2);
		$dd1 = substr($from,3,2);
		$aaaa1 = substr($from,6,4);
		
		$fechaDesde = $aaaa1."-".$mm1."-".$dd1;
		
		$mm2 = substr($to,0,2);
		$dd2 = substr($to,3,2);
		$aaaa2 = substr($to,6,4);
		
		$fechaHasta = $aaaa2."-".$mm2."-".$dd2;
		$duracion = $fechaHasta - $fechaDesde;
		
		$HoraDesde = $hh1.":".$min1.":00";
		$HoraHasta = $hh2.":".$min2.":00";
		
		echo "<br />Hora desde:".$HoraDesde;
		echo "<br />Hora Hasta:".$HoraHasta;

		
$consulta = mysql_query("INSERT INTO `wi310902_estasenposse3`.`agenda` (`EVENTO`, `FECHADESDE`, `FECHAHASTA`, `DURACION`, `TIPO`, `LUGAR`, `LOCALIDAD`, `HORADESDE`, `HORAHASTA`, `DESCRIPCION`, `FOTO`, `LINK`, `DESTACADO`) VALUES ('".$Titulo."', '".$fechaDesde."', '".$fechaHasta."', '".$duracion."', ".$Categoria.",'".$Direccion."',".$Localidad.", '".$HoraDesde."', '".$HoraHasta."', '".$elm1."', '', '".$FuenteLink."', 0)", $conexion) or die(mysql_error());

			echo $Titulo."<br />";
			echo $elm1;
			
			
			$resEmp = mysql_query("SELECT IDAG FROM AGENDA ORDER BY IDAG DESC LIMIT 1", $conexion) or die(mysql_error());
			     
				$rowEmp = mysql_fetch_assoc($resEmp);
				$IDagenda = $rowEmp['IDAG'];
				
				//INFORMA MOVIMIENTO!	
$IP = $_SERVER['REMOTE_ADDR'];
$IDUSU = session_id();	
$resEmp = mysql_query("INSERT INTO  `actualizacion` (  `FECHA` ,  `HORA` ,  `CONCEPTO` ,  `LINK` ,  `IP` ,  `USUARIO` ) 
VALUES (
NOW( ) , NOW( ) ,  'Evento Cargado',  '".$IDagenda."',  '".$IP."', ".$IDUSU."
)", $conexion) or die(mysql_error());
//FIN INFORME MOVIMIENTO

		mysql_close($conexion);
			
			echo "<br /><a href='http://www.estasenposse.com/panel3.0/foto/cargarFotoEvento.php?ID=".$IDagenda."'>Cargar una foto para este evento!</a><br />";
			
		echo "<a href='www.estasenposse.com.ar'>Ir a la página principal</a>'";
				
		//}  else {							
			//	echo "Error!, Volver atrás!";	
	//	}	
		
	} else {
		?>
		<form method="post" action="">
		  <table width="1000" border="0" align="center" cellpadding="0" cellspacing="0">
	        <tr>
	          <td height="39" colspan="4"  bgcolor="#EEEEEE" class="textoSubtituloMasNovedades"><div align="left">Fecha: 
	            <? $fecha = time();
		$dia = date ("w" , $fecha);
		switch ($dia){
			case "0": 	
				$dia = "Domingo";
				break;
			case "1": 	
				$dia = "Lunes";
				break;
			case "2": 	
				$dia = "Martes";
				break;
			case "3": 	
				$dia = "Miércoles";
				break;
			case "4": 	
				$dia = "Jueves";
				break;
			case "5": 	
				$dia = "Viernes";
				break;
			case "6": 	
				$dia = "Sábado";
				break;			
		}
		$mes = date( "F" , $fecha );
		switch($mes){
			case "January";
				$mes = "Enero";
				break;
			case "February";
				$mes = "Febrero";
				break;
			case "March";
				$mes = "Marzo";
				break;
			case "April";
				$mes = "Abril";
				break;
			case "May";
				$mes = "Mayo";
				break;
			case "June";
				$mes = "Junio";
				break;
			case "July";
				$mes = "Julio";
				break;
			case "August";
				$mes = "Agosto";
				break;
			case "September";
				$mes = "Septiembre";
				break;
			case "October";
				$mes = "Octubre";
				break;
			case "November";
				$mes = "Noviembre";
				break;
			case "December": 	
				$mes = "Diciembre";
				break;	
		}
		echo $dia."&nbsp;";
		echo date ( " j " , $fecha );
		echo " de ";
		echo $mes;
		echo " de ";
		echo date("Y" , $fecha ); ?>
	            </div></td>
            </tr>
	        <tr class="DivisorNoticia">
		      <td width="97" height="39" bgcolor="#ededed" class="textoTituloMasNovedades"><div align="right">Fecha:</div></td>
		      <td width="4" bgcolor="#FFFFFF">&nbsp;</td>
		      <td colspan="2" bgcolor="#FFFFFF" class="LineaSimpleDoble"><input type="text" id="from" name="from"/></td>
	        </tr>
		    <tr class="FondoAmarillo">
		      <td height="20" bgcolor="#ededed" class="textoTituloMasNovedades"><div align="right">Nueva farmacia:</div></td>
		      <td>&nbsp;</td>
		      <td bgcolor="#FFFFFF" class="LineaSimpleDoble">&nbsp;</td>
		      <td width="285" bgcolor="#FFFFFF" class="LineaSimpleDoble">&nbsp;</td>
	        </tr>
		    <tr class="FondoGris">
		      <td height="39" bgcolor="#ededed" class="textoTituloMasNovedades">&nbsp;</td>
		      <td bgcolor="#EEEEEE">&nbsp;</td>
		      <td colspan="2" bgcolor="#FFFFFF" class="LineaSimpleDoble"><input name="novedad" type="submit" class="textoTituloMasNovedades" id="novedad" value="Cargar" /></td>
	        </tr>
		    <tr>
		      <td height="39" bgcolor="#ededed" class="textoTituloMasNovedades">&nbsp;</td>
		      <td bgcolor="#FFFFFF">&nbsp;</td>
		      <td width="195" bgcolor="#FFFFFF" class="LineaSimpleDoble">&nbsp;</td>
		      <td bgcolor="#FFFFFF" class="LineaSimpleDoble">&nbsp;</td>
	        </tr>
		    <tr class="DivisorNoticia">
		      <td height="39" bgcolor="#ededed" class="textoTituloMasNovedades">&nbsp;</td>
		      <td>&nbsp;</td>
		      <td colspan="2" bgcolor="#FFFFFF" class="LineaSimpleDoble">&nbsp;</td>
	        </tr>
		    <tr class="DivisorNoticia">
		      <td height="39" bgcolor="#ededed" class="textoTituloMasNovedades">&nbsp;</td>
		      <td>&nbsp;</td>
		      <td colspan="2" bgcolor="#FFFFFF" class="LineaSimpleDoble">&nbsp;</td>
	        </tr>
		    <tr>
		      <td bgcolor="#ededed" class="FechaPrincipal">&nbsp;</td>
		      <td>&nbsp;</td>
		      <td colspan="2" bgcolor="#FFFFFF" class="LineaSimpleDoble">&nbsp;</td>
	        </tr>
		    <tr>
		      <td rowspan="2" bgcolor="#ededed" class="textoTituloMasNovedades">&nbsp;</td>
		      <td height="40" bgcolor="#EEEEEE">&nbsp;</td>
		      <td colspan="2" bgcolor="#FFFFFF" class="LineaSimpleDoble">&nbsp;</td>
	        </tr>
		    <tr>
		      <td height="40">&nbsp;</td>
		      <td colspan="2" align="left" bgcolor="#FFFFFF" class="LineaSimpleDoble">&nbsp;</td>
	        </tr>
		    <tr>
		      <td height="40" bgcolor="#ededed" class="textoTituloMasNovedades">&nbsp;</td>
		      <td bgcolor="#EEEEEE">&nbsp;</td>
		      <td colspan="2" bgcolor="#FFFFFF" class="LineaSimpleDoble">&nbsp;</td>
	        </tr>
		    <tr>
		      <td height="51">&nbsp;</td>
		      <td height="51">&nbsp;</td>
		      <td height="51" colspan="2">&nbsp;</td>
	        </tr>
		    <tr>
		      <td height="51" colspan="4">&nbsp;</td>
	        </tr>
		    <tr>
		      <td height="51">&nbsp;</td>
		      <td height="51">&nbsp;</td>
		      <td height="51">&nbsp;</td>
		      <td height="51"></td>
	        </tr>
	      </table>
		  <div align="center"></div>
      </form>
	<?
	}
	?>
  
    </td>
  </tr>
  <tr>
    <td colspan="3" bgcolor="#333333">&nbsp;</td>
  </tr>
  <tr>
    <td colspan="3" class="LinksActivos"><div align="center"></div></td>
  </tr>
</table>
</body>
</html>